using AutoMapper;
using UwinEducation.Application.Dtos;
using UwinEducation.Domain.Entities;

namespace UwinEducation.Application.Mappings
{
    /// <summary>
    /// 系统配置的AutoMapper配置
    /// </summary>
    public class SystemConfigProfile : Profile
    {
        public SystemConfigProfile()
        {
            // SystemConfig -> SystemConfigDto
            CreateMap<SystemConfig, SystemConfigDto>();
            
            // CreateSystemConfigDto -> SystemConfig
            //CreateMap<CreateSystemConfigDto, SystemConfig>()
            //    .ForMember(dest => dest.Id, opt => opt.Ignore())
            //    .ForMember(dest => dest.CreatedAt, opt => opt.Ignore())
            //    .ForMember(dest => dest.CreatedBy, opt => opt.Ignore())
            //    .ForMember(dest => dest.UpdatedAt, opt => opt.Ignore())
            //    .ForMember(dest => dest.UpdatedBy, opt => opt.Ignore())
            //    .ForMember(dest => dest.IsDeleted, opt => opt.Ignore())
            //    .ForMember(dest => dest.RowVersion, opt => opt.Ignore());
            
            // UpdateSystemConfigDto -> SystemConfig
            CreateMap<UpdateSystemConfigDto, SystemConfig>()
                .ForMember(dest => dest.Key, opt => opt.Ignore())
                .ForMember(dest => dest.CreatedAt, opt => opt.Ignore())
                .ForMember(dest => dest.CreatedBy, opt => opt.Ignore())
                .ForMember(dest => dest.UpdatedAt, opt => opt.Ignore())
                .ForMember(dest => dest.UpdatedBy, opt => opt.Ignore())
                .ForMember(dest => dest.IsDeleted, opt => opt.Ignore());
        }
    }
} 